﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ass5Vinyl.VIEW
{
    public partial class GetEmployeeID : Form
    {
        VIEW.DBViewer dbViewer;
        public GetEmployeeID()
        {
            InitializeComponent();
            dbViewer = new VIEW.DBViewer();
        }

        private void b_run_Click(object sender, EventArgs e)
        {

            DataTable dt = CONTROLLER.DataQueries.PersonExist(tb_employeeId.Text, "employee");
            if (dt.Rows.Count > 0)
            {
                try
                {
                    dbViewer.FillData(dt);
                    dbViewer.ShowDialog();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
                MessageBox.Show("Employee doesn't excit");
        }
    }
}
